package com.top75;

import com.bean.ListNode;

/**
 * @Author: huangzhigao
 * @Date: 2023/5/22 20:15
 */
public class Code328 {
    public ListNode oddEvenList(ListNode head) {
        if (head == null) {
            return null;
        }

        ListNode odd = head;
        ListNode even = head.next;
        while (odd != null && odd.next != null) {
            odd.next = even.next;
            odd = odd.next;
            even.next = odd.next;
            even = even.next;
        }
        return head;
    }
}
